package View;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.geom.Rectangle2D;

import javax.swing.BorderFactory;
import javax.swing.JPanel;

/**
 * 
 * @author stephenbwilliamson
 */
public class GeneBar extends JPanel {
	private static final long serialVersionUID = 9142179321481866003L;
	private Rectangle2D.Double rect;
	private Color color;
	private int width;
	private int height;
	private Point topLeft;
	private int geneIndex;

	private static int GENE_INDEX = 0;

	public GeneBar(int x, int y, int width, int height) {
		setBackground(Color.WHITE);
		setBorder(BorderFactory.createLineBorder(Color.black));
		this.width = width;
		this.height = height;
		topLeft = new Point(x, y);
		geneIndex = GENE_INDEX++;
		this.setSize(width, height);
		rect = new Rectangle2D.Double(topLeft.getX(), topLeft.getY(), width,
				height);
	}

	// @Override public void paint (Graphics g) {
	// Graphics2D g2d = (Graphics2D) g;
	// g2d.setColor(color);
	// g2d.fill(rect);
	// }

	public Rectangle2D.Double getRectangle() {
		return rect;
	}

	public int getID() {
		return geneIndex;
	}

	@Override
	public int getHeight() {
		return height;
	}

	@Override
	public int getWidth() {
		return width;
	}

	@Override
	public Dimension getPreferredSize() {
		return new Dimension(width, height);
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public Color getColor() {
		return color;
	}
}
